package com.bobbygu.googlearchitecture.bean

import android.arch.lifecycle.LiveData
import android.arch.persistence.room.*

/**
 *
 * # time: 2017/12/20 10:10
 * # e-mail: gubojun@csii.com.cn
 * @author 顾博君
 * @since 1.0
 */
@Dao
interface StoryDao {
    @Query("select * from stories")
    fun loadAllStories(): LiveData<List<Story>>

    @Query("select * from stories")
    fun getAllStories(): List<Story>

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    fun insertStories(list: List<Story>)

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    fun insertStories(vararg story: Story)

    @Query("delete from stories")
    fun deleteAllStories(): Int

    @Delete
    fun deleteStories(vararg story: Story): Int

    @Update
    fun updateStories(vararg story: Story): Int
}